#!/bin/bash

# mkdir workspace
cd /root/ocean
gil update
rm -rf build
mkdir build
mkdir build/packages
mkdir build/cpu-static
mkdir build/cpu-shared

# build cpu static
cd build/cpu-static
cmake -DCMAKE_INSTALL_PREFIX=../packages/cpu-static -DCMAKE_INSTALL_LIBDIR=lib -DOCEAN_ENABLE_CUDA=OFF -DOCEAN_BUILD_SHARED_LIBS=OFF ../../
make install -j24
cd ../packages/cpu-static/
tar -cvzf /root/ocean/packages/ocean-${PACKAGES}-${VERSION}-`arch`-static.tar.gz *

# build cpu shared
cd /root/ocean/build/cpu-shared
cmake -DCMAKE_INSTALL_PREFIX=../packages/cpu-shared -DCMAKE_INSTALL_LIBDIR=lib -DOCEAN_ENABLE_CUDA=OFF -DOCEAN_BUILD_SHARED_LIBS=ON ../../
make install -j24
cd ../packages/cpu-shared/ 
tar -cvzf /root/ocean/packages/ocean-${PACKAGES}-${VERSION}-`arch`-shared.tar.gz *